const { no, ok } = require('../../utils/utlis');

const commentService = require('../../services/client/commentService');
module.exports = {
	// 获取文章评论列表
	list: async (req, res, next) => {
		try {
			let { id } = req.body;
			let obj =  await commentService.list(id);
                  res.send(ok(obj));
		} catch (error) {
			res.send(no(error.message));
		}
	},
	add: async (req, res, next) => {
		try {
			let { acticleId, userId, username, avatar, content, toUserId, toUsername, toAvatar, commentId,type } = req.body;
			await commentService.add(acticleId, userId, username, avatar, content, toUserId, toUsername, toAvatar, commentId,type);
                  res.send(ok());
		} catch (error) {
			res.send(no(error.message));
		}
	}
};
